unit ManuelBarkodBasimi;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormClass, XPMan, StdActns, ActnList, StdCtrls, ComCtrls,
  wwriched, Mask, wwdbedit, ppPrnabl, ppClass, ppStrtch, ppMemo, ppCache,
  ppBands, ppComm, ppRelatv, ppProd, ppReport, RAWPrinter, ExtCtrls,
  ppCtrls, ppBarCod, ppParameter, ppVar, jpeg;

type
  TfmManuelBarkodBasimi = class(TfmFormClass)
    Memo1: TMemo;
    rprn1: TRAWPrinter;
    ppReport1: TppReport;
    ppDetailBand1: TppDetailBand;
    Panel1: TPanel;
    Sayi: TwwDBEdit;
    Label2: TLabel;
    BarkodBas: TButton;
    BarkodBas2: TButton;
    ppBarCode1: TppBarCode;
    BBas: TButton;
    RAWPrinter1: TRAWPrinter;
    ppEtiket: TppReport;
    ppDetailBand3: TppDetailBand;
    ppBarkod: TppBarCode;
    ppParameterList2: TppParameterList;
    Button1: TButton;
    ppPalet: TppReport;
    ppDetailBand2: TppDetailBand;
    ppParameterList3: TppParameterList;
    ppLabel1: TppLabel;
    ppSystemVariable1: TppSystemVariable;
    ppBarCode2: TppBarCode;
    ppLabel2: TppLabel;
    Button2: TButton;
    ppKasa: TppReport;
    ppDetailBand4: TppDetailBand;
    ppParameterList1: TppParameterList;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    ppBarCode3: TppBarCode;
    ppLabel5: TppLabel;
    ppBarCode4: TppBarCode;
    Button3: TButton;
    Button4: TButton;
    ppManuel: TppReport;
    ppDetailBand6: TppDetailBand;
    ppParameterList5: TppParameterList;
    ppLabel6: TppLabel;
    ppLabel7: TppLabel;
    ppBarCode5: TppBarCode;
    ppLabel8: TppLabel;
    ppBarCode6: TppBarCode;
    ppLabel9: TppLabel;
    Label1: TLabel;
    edKodu: TwwDBEdit;
    ppKurulumBarkod: TppReport;
    ppDetailBand5: TppDetailBand;
    ppBarCode7: TppBarCode;
    ppParameterList4: TppParameterList;
    ppLabel10: TppLabel;
    Button5: TButton;
    ppImage1: TppImage;
    Button6: TButton;
    ppEan: TppReport;
    ppDetailBand7: TppDetailBand;
    ppBarCode9: TppBarCode;
    ppLabel14: TppLabel;
    ppParameterList6: TppParameterList;
    ppPaket: TppReport;
    ppDetailBand8: TppDetailBand;
    ppImage6: TppImage;
    ppLabel42: TppLabel;
    ppLabel43: TppLabel;
    btPaketihale: TButton;
    ppLabel11: TppLabel;
    ppLabel12: TppLabel;
    ppLabel13: TppLabel;
    ppLabel15: TppLabel;
    ppLabel16: TppLabel;
    ppLabel17: TppLabel;
    ppLabel18: TppLabel;
    ppLabel23: TppLabel;
    ppLabel24: TppLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BarkodBasClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BarkodBas2Click(Sender: TObject);
    procedure BBasClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure btPaketihaleClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmManuelBarkodBasimi: TfmManuelBarkodBasimi;

implementation
uses data;
{$R *.dfm}

procedure TfmManuelBarkodBasimi.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmManuelBarkodBasimi := nil;
end;

procedure TfmManuelBarkodBasimi.BarkodBasClick(Sender: TObject);
var
  Counter, Counter2, X, y: Integer;
begin
  inherited;
  if Trim(Sayi.Text) = '' then
    Sayi.Text := '1';
//  (ppReport1.FindUserObject('Memo1') as TppMemo).Text := Memo1.Text;
//  ppReport1.Print;
  for Counter := 0 to StrToInt(Sayi.Text) - 1 do
  begin
    y := 0;
    rprn1.BeginDoc;
    rprn1.WriteLn('N');
    rprn1.WriteLn('ZB');
    rprn1.WriteLn('R0,0');
    for Counter2 := 0 to Memo1.Lines.Count - 1 do
    begin
      if (Counter2 = 2) or (Counter2 = 10) then
      begin
        x := 3;
        y := y + 5;
      end
      else
        x := 1;
      rprn1.WriteLn('A55,' + inttostr(2 + y + (Counter2 * 35)) + ',0,' + inttostr(x) + ',' + inttostr(x) + ',2,N,"' + Memo1.Lines.Strings[counter2] + '"');
    end;
    rprn1.WriteLn('P1');
    rprn1.EndDoc;
  end;
end;

procedure TfmManuelBarkodBasimi.FormCreate(Sender: TObject);
begin
  inherited;
  Sayi.Text := '1';
end;

procedure TfmManuelBarkodBasimi.BarkodBas2Click(Sender: TObject);
begin
  inherited;
  (ppReport1.FindUserObject('BarCode1') as TppBarCode).Data := Memo1.Text;
  ppReport1.Print;
end;

procedure TfmManuelBarkodBasimi.BBasClick(Sender: TObject);
var
  Counter: Integer;
begin
  inherited;
  if Trim(Sayi.Text) = '' then
    Sayi.Text := '1';
//  (ppReport1.FindUserObject('Memo1') as TppMemo).Text := Memo1.Text;
//  ppReport1.Print;
  for Counter := 0 to StrToInt(Sayi.Text) - 1 do
  begin
    RAWPrinter1.BeginDoc;
    RAWPrinter1.WriteLn('N');
    RAWPrinter1.WriteLn('ZB');
    RAWPrinter1.WriteLn('R0,0');
    RAWPrinter1.WriteLn('A250,50,0,1,2,2,N,"' + Memo1.Text + '"');
    RAWPrinter1.WriteLn('B50,100,0,3,3,4,70,N,"' + Memo1.Text + '"');
    RAWPrinter1.WriteLn('P1');
    RAWPrinter1.EndDoc;
  end;
end;

procedure TfmManuelBarkodBasimi.Button1Click(Sender: TObject);
begin
  inherited;
  (ppEtiket.FindUserObject('Barkod') as TppBarCode).Data := Memo1.Text;
  ppEtiket.Print;
end;

procedure TfmManuelBarkodBasimi.Button2Click(Sender: TObject);
begin
  inherited;
  (ppPalet.FindUserObject('Palet') as TppLabel).Caption := Memo1.Text;
  (ppPalet.FindUserObject('Barkod') as TppBarCode).Data := Memo1.Text;
  ppPalet.Print;
end;

procedure TfmManuelBarkodBasimi.Button3Click(Sender: TObject);
var
  Counter, Counter2: Integer;
begin
  inherited;
  for Counter := 0 to Memo1.Lines.Count - 1 do
  begin
    (ppKasa.FindUserObject('Kodu') as TppLabel).Caption := Trim(edKodu.Text);
    (ppKasa.FindUserObject('Barkods') as TppLabel).Caption := Memo1.Lines.Strings[Counter];
    (ppKasa.FindUserObject('Barkod') as TppBarCode).Data := Memo1.Lines.Strings[Counter];
    for Counter2 := 1 to StrToInt(sayi.Text) do
      ppKasa.Print;
  end;
end;

procedure TfmManuelBarkodBasimi.Button4Click(Sender: TObject);
var
  Counter, Counter2: Integer;
begin
  inherited;
  for Counter := 0 to Memo1.Lines.Count - 1 do
  begin
    if Trim(Memo1.Lines.Strings[Counter]) <> '' then
    begin
      (ppManuel.FindUserObject('Barkods') as TppLabel).Caption := UpperCase(Memo1.Lines.Strings[Counter]);
      (ppManuel.FindUserObject('Barkod') as TppBarCode).Data := UpperCase(Memo1.Lines.Strings[Counter]);
      OpenQueryOnDataSet('Select Barkod From Stok Where Stokkod=(Select Stokkod from fatharhar Where Serinos="' + UpperCase(Memo1.Lines.Strings[Counter]) + '")', dm.Bosislem2);
      (ppManuel.FindUserObject('Barkod2') as TppBarCode).Data := dm.Bosislem2.fieldbyName('Barkod').AsString;
      for Counter2 := 1 to StrToInt(sayi.Text) do
        ppManuel.Print;
    end;
  end;
end;

procedure TfmManuelBarkodBasimi.Button5Click(Sender: TObject);
var
  Counter, Counter2: integer;
begin
  inherited;
  for Counter := 0 to Memo1.Lines.Count - 1 do
  begin
    (ppKurulumBarkod.FindUserObject('LBarkod') as TppLabel).Caption := Memo1.Lines.Strings[Counter];
    (ppKurulumBarkod.FindUserObject('Barkod') as TppBarCode).Data := Memo1.Lines.Strings[Counter];
    for Counter2 := 1 to StrToInt(sayi.Text) do
      ppKurulumBarkod.Print;
  end;
end;

procedure TfmManuelBarkodBasimi.Button6Click(Sender: TObject);
var
  Counter: Integer;
begin
  inherited;
  for Counter := 1 to StrToInt(Sayi.Text) do
  begin
    (ppEan.FindUserObject('Kodu') as TppLabel).Caption := Trim(edKodu.Text);
    (ppEan.FindUserObject('Barkod2') as TppBarCode).Data := Memo1.Lines.Strings[0];
    ppEan.Print;
  end;
end;

procedure TfmManuelBarkodBasimi.btPaketihaleClick(Sender: TObject);
var
 Counter:Integer;
begin
  inherited;
  for Counter := 1 to StrToInt(Sayi.Text) do
  begin
    ppPaket.Print;
  end;
end;

end.

